﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using H3Cheater;

namespace H3Cheater
{
    public class Skill
    {
              public byte[,] SkillJL = new byte[18, 28]{
            {4,5,5,4,4,8,10,3,2,3,8,2,0,6,1,3,4,2,1,7,5,4,7,5,1,1,5,2},
            {2,3,4,3,7,5,2,7,4,5,4,6,0,3,2,4,4,3,6,2,2,4,4,3,6,5,2,10},
            {7,8,5,7,4,3,6,3,3,6,4,2,0,2,0,1,3,3,1,5,6,4,5,8,2,2,9,3},
            {5,5,5,2,4,2,2,8,6,9,4,7,0,3,1,2,4,4,8,1,1,4,1,3,7,6,1,7},
            {4,5,6,4,3,3,3,6,4,2,6,3,0,4,1,4,2,3,3,4,4,10,6,8,4,3,5,2},
            {2,2,2,2,4,1,4,10,8,4,4,8,0,5,2,6,3,3,9,1,1,4,1,1,10,8,0,7},
            {4,6,10,5,4,4,3,4,2,2,7,3,0,3,4,2,1,3,2,6,5,4,8,7,2,3,6,2},
            {4,4,3,3,3,2,2,8,10,2,6,4,0,2,5,3,2,4,5,4,4,4,4,4,6,6,3,5},
            {4,5,5,4,2,8,0,6,4,1,7,4,10,0,1,2,3,4,2,5,5,4,7,5,5,4,5,0},
            {6,2,4,2,4,5,0,8,6,1,5,7,10,3,2,3,3,8,6,2,3,4,3,2,6,6,1,0},
            {5,6,8,5,3,4,8,3,3,1,7,2,0,4,2,1,0,3,1,10,8,4,8,6,1,2,6,1},
            {2,2,2,2,4,4,3,10,8,2,6,8,0,5,5,2,2,5,8,1,1,4,1,1,8,10,0,6},
            {8,7,7,8,1,2,5,2,3,3,8,2,0,2,2,3,0,3,1,8,8,4,10,6,1,1,6,1},
            {4,4,9,4,3,0,4,6,4,2,6,5,0,1,3,3,3,3,4,5,4,4,8,4,5,6,4,4},
            {8,7,8,7,1,8,5,2,2,2,7,1,0,1,0,1,2,3,1,6,8,4,5,10,1,1,5,6},
            {2,3,3,2,2,6,1,8,8,4,8,10,0,1,3,3,3,3,7,1,1,4,2,4,7,8,0,8},
            {6,8,8,6,2,5,3,2,3,2,8,2,0,3,3,2,2,3,1,8,8,8,9,5,1,1,2,1},
            {2,2,2,2,4,4,3,8,8,2,4,8,0,3,6,6,6,6,8,1,1,4,1,1,8,8,0,4}
            };
        /*    计算智慧术    */
        
        public void Skill8()     //判断是否学满8个技能
        {
            int x = 0;
            foreach (int i in THero.SkillLv)
            {
                if (i != 0)
                {
                    x++;
                    if (x == 8)
                    {
                        THero.Skill8 = true;
                    }
                }
            }
        }


        public void Wisdom()
        {
            if (THero.SkillLv[7]!= 3)                                            //判断有智慧术且不是3级方可下一步
            {
                int N = 0;                                               //已学技能数量统计
                for (int i = 0; i < THero.SkillLv.Length; i++)
                {
                    if (THero.SkillLv[i]!=0)
                    {
                        N++;
                    }
                }
                if (!(N == 8)&&(THero.SkillLv[7] == 0))                       //判断已8个技能且无智慧术，跳出，否则下一步
                {
                   if ((THero.Level + 1) >= (THero.LastWisdom + THero.Wisdom))            //进入强制学习智慧术判断
                    {

                        if (THero.SkillLv[7] == 0)                               //没学过智慧术，分其他技能全3级则左侧，未满右侧
                        {

                                foreach (int i in THero.SkillLv)
                                {
                                    if ((i == 1) && (i == 2))                     //有不满级的技能
                                    {
                                    THero.SkillRight = 7;
                                    THero.LeftLv = (byte)(THero.SkillLv[7] + 1);      //技能和等级先赋值给左槽，左槽点击后方更改英雄技能数组
                                    THero.LastWisdom = THero.Level;
                                }
                                else                                             //已学技能全满级了
                                {
                                    THero.SkillLeft = 7;
                                    THero.LeftLv = (byte)(THero.SkillLv[7] + 1);      //技能和等级先赋值给左槽，左槽点击后方更改英雄技能数组
                                    THero.LastWisdom = THero.Level;
                                }
                            }
                        }
                        else                                            //学过智慧术出现在左侧
                        {
                            THero.SkillLeft = 7;                           
                            THero.LeftLv= (byte)(THero.SkillLv[7] + 1);      //技能和等级先赋值给左槽，左槽点击后方更改英雄技能数组
                            THero.LastWisdom = THero.Level;
                        }
                    }
                }
            }
        }

        public void Magic4()                                           //四系魔法强制判断，从技能槽开始分支
        {
           if ((THero.Level + 1) >= (THero.LastMagic + THero.Magic))          //判断是否进入强制阶段
            {
                if (THero.SkillLeft==255)      //左侧技能槽为空，空即255
                  {
                    foreach (int i in THero.SkillLv)
                    {
                        if ((i == 1) || (i == 2))               //已有技能不全高
                        {




                        }
                        else                                   //已有技能全高级
                        {
                            uint x = 0;
                            for (int y = 14; y < 18; y++)
                            {
                            if ((SkillJL[THero.HClass, y] != 0) && (THero.SkillLv[y]==0))  //判断有那几个元素魔法可以学习
                             {
                                    x++;   //判断有几个新元素魔法科学
                             }
                            }
                            uint q = THero.Sec2 % x;
                            for (uint z = 1; z == q; z++)
                            {




                            }




                        }






                    }





                }







            }





        }




    }
}
